/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
 * Description: Hmfs-tools check point
 */

#ifndef HMFS_COMPARE_CP_H
#define HMFS_COMPARE_CP_H

#include <memory>
#include <string>
#include <sys/types.h>

#include "compare_data.h"
#include "hmfs_fs.h"

namespace OHOS {
namespace Hmfs {

class CompareCheckPoint {
public:
    CompareCheckPoint(FsData &srcInfo, FsData &dstInfo) : srcInfo_(srcInfo), dstInfo_(dstInfo)
    {
    }
    ~CompareCheckPoint() = default;

    int32_t CompareCheckPointBinary();

private:
    int32_t ReadCheckPointArea(FsData &fsInfo);
    int32_t CompareCheckPointFirstSegment();
    int32_t CompareCheckPointSecondSegment();
    int32_t CompareCheckPointBlock(CheckPointData *srcCp, CheckPointData *dstCp);
    int32_t CompareSumCompact();
    int32_t CompareJournalEntry(JournalEntry *srcJournal, JournalEntry *dstJournal, int journalType);
    int32_t CompareNatJournal(NatJournal *srcNatJournal, NatJournal *dstNatJournal);
    int32_t CompareSitJournal(SatJournal *srcSitJournal, SatJournal *dstSitJournal);
    int32_t CompareSummaryEntry(SummaryEntry *srcSumEntry, SummaryEntry *dstSumEntry);
    int32_t CompareHotNodeSummary();
    int32_t CompareNatBit(char *srcbuf, char *dstCp, uint32_t natBitmapSize, uint32_t natBitsAreablocks);

    FsData& srcInfo_;
    FsData& dstInfo_;
};

} // namespace Hmfs
} // namespace OHOS
#endif
